<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@ page import="java.util.ArrayList" %>
<%@ page import="com.ba360.portal.database.dbo.SearchAgent" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
	com.ba360.portal.database.dbo.User user = (com.ba360.portal.database.dbo.User)session.getAttribute("USER");
	if (user==null)
	{
	request.setAttribute("USER_NOT_LOGGED_IN","UNPLUGGED");
	%>

	<jsp:forward page="/portal/login.do"/>

	<%}%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>droik.com</title>
<link href="../css/sample1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-image: url(../images/main_bg2.gif);
}
.style2 {color: #88DB23}
.style3 {color: #FFFFFF}
.style10 {color: #CC3300}
-->
</style>
</head>
<script language="javascript">
function cancel() 
{
	var url = "../jsp/SearchAgentMain.jsp";
	window.location.href = url;
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<jsp:include page="top.jsp"/>
<br>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td><img src="../images/classifieds_n_tab.gif" width="720" height="76" border="0" usemap="#Map" href="../portal/index.do"></td>
	</tr>
	<tr>
		<td background="../images/border_bg2.gif">
			<table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
				<%
				ArrayList searchAgents = null;
				if (session.getAttribute("EDITAGENT") != null) 
				{
					searchAgents = (ArrayList) session.getAttribute("EDITAGENT");
				}
				if(searchAgents==null || searchAgents.size()==0) 
				{
				%>
					There is no search agent created by you.
				<%
				} 
				else 
				{
					for(int i=0; i<searchAgents.size(); i++) 
					{
						SearchAgent agent = (SearchAgent) searchAgents.get(i);
						%>
				<tr>
					<td align="center"></td>
				</tr>
				<tr>
					<td colspan="5">
						<table border="0" cellpadding="3" cellspacing="1" width="100%" class="text"  bgcolor="#99CC33">
							<tr>
								<td width="27%"></td>
								<td width="13%"></td>
							</tr>
							<tr class="text">
								<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
									<div align="justify"><font class="label">Required Keywords:</font></div>
								</td>
								<td bgcolor="#FFFFFF" > 
									<div align="justify"> <%=agent.getKeywords()%></div>
								</td>
							</tr>
								<script language="javascript">
									function submit() 
									{
										var url = "../portal/DeleteSearchAgent.do?action=DELETE_AGENT&keywords=" + "<%=agent.getKeywords()%>";
										window.location.href = url;
									}
								</script>
							<tr class="text">
								<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
									<div align="justify"><font class="label">Ads Must Match:</font></div>
								</td>
								<td bgcolor="#FFFFFF" > 
									<div align="justify">
									<%
									if(agent.getMatchtype() == 1) 
									{
									%>
										All of my keywords
										<%
									} 
									else 
									{
										%>
										Any of my keywords
										<%
									}
										%>
									</div>
								</td>
							</tr>
							<tr class="text">
								<td  align="right" class="boldtext" nowrap height="24" bgcolor="#FFFFFF">
									<div align="justify"><font class="label">Time Frame to Keep the agent (Example: Enter 10 for 10 days):</font></div>
								</td>
								<td bgcolor="#FFFFFF" > <div align="justify"><%=agent.getTimeframe()%></div>
								</td>
							</tr>
							<tr class="text">
								<td bgcolor="#FFFFFF" align="right" valign="top" >
									<div><input type="button"  onClick="javascript:submit()" value="Delete Agent"> </div>
								</td>
								<td bgcolor="#FFFFFF" align="left" valign="top" >
									<div><input name="Back" value="Cancel" onClick="javascript:cancel()" type="button"> </div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
<%
					}
				}
%>
			</table>
		</td>
	</tr>
	<tr>
		<td><img src="../images/border_bot2.gif" width="719" height="20"></td>
	</tr>
</table>
<br>
<br>
<jsp:include page="../jsp/footer.html"/>
<jsp:include page="map.html"/>
</body>
</html>
